import random
from EmpVoting.EmpUtils import ScoringRules

class UniformRandomPrefsAgentGen(object):
    '''
    Generates preference ordering at random
    '''


    def __init__(self, scoringRule):
        '''
        Constructor
        '''
        self.scoringRule = scoringRule
        
        
    def Apply(self, network):
        
        for agent in network.agentList:
            
            curAgentPrefOrder = list(network.alternativeSet)
            random.shuffle(curAgentPrefOrder)
            curAgentIntrinsicUtils = ScoringRules.ApplyScoringRule(self.scoringRule, curAgentPrefOrder)

            agent.prefOrder = curAgentPrefOrder
            agent.intrinsicUtilDict = curAgentIntrinsicUtils
